<?php
include("db/connect.php");
$sqlselectcustomer="select * from customer,province,amphur,tambol";
$sqlselectcustomer.=" where customer.province_id=province.province_id and";
$sqlselectcustomer.=" customer.amphur_id=amphur.amphur_id and";
$sqlselectcustomer.=" customer.tambol_id=tambol.tambol_id and";
$sqlselectcustomer.=" cus_id like '%".$_POST["txtsearch"]."%' group by cus_id";
$queryselectcustomer=mysql_query($sqlselectcustomer);
?>
<table width="100%" height="132" border="0">
  <tr>
    <th width="15%">ชื่อ</th>
    <th width="9%">นามสกุล</th>
    <th width="9%">ที่อยู่</th>
    <th width="7%">ตำบล</th>
    <th width="7%">อำเภอ</th>
    <th width="7%">จังหวัด</th>
    <th width="13%">รหัสไปรษณีย์</th>
    <th width="13%">เบอร์โทรศัพท์</th>
    <th width="7%">Email</th>
    <th width="7%">แก้ไข</th>
    <th width="6%">ลบ</th>
  </tr>
  <?php 
  while($resultcustomer=mysql_fetch_array($queryselectcustomer)){
  ?>
  <tr>
    <td><?php echo $resultcustomer["cus_name"]?></td>
    <td><?php echo $resultcustomer["cus_lastname"]?></td>
    <td><?php echo $resultcustomer["cus_addr"]?></td>
    <td><?php echo $resultcustomer["tambol_name"]?></td>
    <td><?php echo $resultcustomer["amphur_name"]?></td>
    <td><?php echo $resultcustomer["province_name"]?></td>
    <td><?php echo $resultcustomer["cus_postal"]?></td>
    <td><?php echo $resultcustomer["cus_tel"]?></td>
    <td><?php echo $resultcustomer["cus_mail"]?></td>
    <td><a href="Javascript:ajaxmanage(2,<?php echo $resultcustomer["cus_id"];?>);">แก้ไข</a></td>
    <td><a href="Javascript:ajaxmanage(1,<?php echo $resultcustomer["cus_id"];?>);">ลบ</a></td>
  </tr>
  <?php }?>
</table>